package fmod.org.smali.myapplication.fragments;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import fmod.org.smali.myapplication.R;
import fmod.org.smali.myapplication.views.PlayerDiscViewFlipper;
import fmod.org.smali.myapplication.views.PlayerDiscViewFlipperTemp;

public class PlayerFragment extends Fragment {
    private static final String TAG = "PlayerFragment";
    private static final String ARG_PARAM1 = "param1";
    private static final String ARG_PARAM2 = "param2";
    private String mParam1;
    private String mParam2;
    private View.OnClickListener OnlastListener = new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            mVf.smoothScrollTo(false);
        }
    };
    private View.OnClickListener OnnextListener = new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            mVf.smoothScrollTo(true);
        }
    };
    private PlayerDiscViewFlipper mVf;

    public PlayerFragment() {}

    public static PlayerFragment newInstance(String param1, String param2) {
        PlayerFragment fragment = new PlayerFragment();
        Bundle args = new Bundle();
        args.putString(ARG_PARAM1, param1);
        args.putString(ARG_PARAM2, param2);
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (getArguments() != null) {
            mParam1 = getArguments().getString(ARG_PARAM1);
            mParam2 = getArguments().getString(ARG_PARAM2);
        }
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.player_view, container, false);
        mVf = (PlayerDiscViewFlipper) view.findViewById(R.id.vf);
        view.findViewById(R.id.last).setOnClickListener(OnlastListener);
        view.findViewById(R.id.next).setOnClickListener(OnnextListener);
        mVf.setOnPlayerDiscListener(new PlayerDiscViewFlipper.FlipperListener() {
            @Override
            public void onScrollFinished(boolean hasDisplayNextView, boolean isAutoScrollMode, boolean isScrollToRight) {

            }
            @Override
            public void onStartScroll(Boolean aBoolean) {

            }
            @Override
            public void onScrollOverCener(Boolean aBoolean) {

            }
            @Override
            public void m5742a(boolean b) {

            }
        });
        return view;
    }
}
